package com.liufh;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: liufh
 * @create: 2022-01-13 17:08
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients  // 开启Feign 客户端功能
//@RibbonClients(defaultConfiguration = AutodeliverFeignApplication8092.DefaultRibbonConfig.class) // 定义全局负载均衡策略
public class AutodeliverFeignApplication8092 {

    public static void main(String[] args) {
        SpringApplication.run(AutodeliverFeignApplication8092.class, args);
    }

    // 指定使用的负载均衡策略
//    @Configuration
//    public class DefaultRibbonConfig {
//        @Bean
//        public IRule ribbonRule() {
//            return new RandomRule();
//        }
//    }

}
